//
//  Save_UserDunPanViewController.m
//  fxxiaoke
//
//  Created by 鞠超 on 2016/10/24.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "Save_UserDunPanViewController.h"

@interface Save_UserDunPanViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView * tableView;

@property (nonatomic, strong) UIView * view_Top;

@property (nonatomic, strong) UIView * view_bottom;

@end

@implementation Save_UserDunPanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self p_navi];
    
    [self p_setupView];
    
    [self p_bottomView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - navi
- (void )p_navi
{
    _btnLeft.hidden = YES;
    _lblLeft.hidden = YES;
    _btnRight.hidden = YES;
    _lblRight.hidden = YES;
    
    _lblTitle.text = @"选择保存的位置";
    _topView.backgroundColor = navi_bar_bg_color;
    
    //左返回
    UIImageView * image_LeftRetrun = [[UIImageView alloc] initWithFrame:CGRectMake(11, 31.5, 25, 25)];
    image_LeftRetrun.userInteractionEnabled = YES;
    image_LeftRetrun.image = [UIImage imageNamed:@"Left-return.png"];
    [_topView addSubview:image_LeftRetrun];
    
    UILabel * lbl_return = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_LeftRetrun.frame) - 6, 35, 40, 15)];
    lbl_return.text = @"取消";
    lbl_return.textColor = [UIColor whiteColor];
    lbl_return.font = [UIFont systemFontOfSize:17];
    [_topView addSubview:lbl_return];
    
    UIButton * btn_return = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_return.frame = CGRectMake(10, 22, 65, 40);
    [_topView addSubview:btn_return];
//    btn_return.backgroundColor = [UIColor greenColor];
    [btn_return addTarget:self action:@selector(btn_returnAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    UIImageView * image_Setting = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 35, 32, 20, 20)];
    image_Setting.image = [UIImage imageNamed:@"Add_DocumentName.png"];
    [_topView addSubview:image_Setting];
    
    UIButton * btn_Setting = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_Setting.frame = CGRectMake(SCREEN_WIDTH - 10 - 35, 24.5, 35, 35);
    [_topView addSubview:btn_Setting];
    [btn_Setting addTarget:self action:@selector(SettingAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

//左返回
- (void )btn_returnAction:(UIButton *)sender
{
    [self dismissViewControllerAnimated:YES completion:^{
    }];
}

//添加文件夹名称
- (void)SettingAction:(UIButton *)sender
{
    NSLog(@"点击添加文件夹名称");
}

//显示tabbar
- (void )viewWillAppear:(BOOL)animated
{
    [(AppDelegate *)[[UIApplication sharedApplication] delegate] hiddenTabBar];
}

#pragma mark - 布局
- (void )p_setupView
{
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64 - 60) style:(UITableViewStylePlain)];
    self.tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableFooterView = [[UIView alloc] init];
    //
    [self p_headView];
    self.tableView.tableHeaderView = self.view_Top;
    
    [self.view addSubview:self.tableView];
}

#pragma mark - tableView代理
- (NSInteger )numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [[UITableViewCell alloc] init];
    
    return cell;
}

#pragma mark - 底部视图
- (void )p_bottomView
{
    self.view_bottom = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 60, SCREEN_WIDTH, 60)];
    self.view_bottom.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.view_bottom];
    
    UIButton * btn_save = [UIButton buttonWithType:(UIButtonTypeCustom)];
    btn_save.frame = CGRectMake(10, 10, SCREEN_WIDTH - 20, 40);
    btn_save.layer.cornerRadius = 5;
    btn_save.backgroundColor = [UIColor colorWithRed:90/255.0 green:167/255.0 blue:239/255.0 alpha:1.0];
    [btn_save setTitle:@"保存" forState:(UIControlStateNormal)];
    [self.view_bottom addSubview:btn_save];
    [btn_save addTarget:self action:@selector(btn_saveAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

#pragma mark - 点击保存
- (void )btn_saveAction:(UIButton *)sender
{
    NSLog(@"点击保存");
}

#pragma mark - 头视图
- (void )p_headView
{
    self.view_Top = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 45)];
    self.view_Top.backgroundColor = [UIColor whiteColor];
    
    UIView * view_bg = [[UIView alloc] initWithFrame:CGRectMake(0, - 1000, SCREEN_WIDTH, 1045)];
    view_bg.backgroundColor = [UIColor whiteColor];
    [self.view_Top addSubview:view_bg];
    
    UILabel * lbl_title = [[UILabel alloc] initWithFrame:CGRectMake(15, 1000 + 15, SCREEN_WIDTH - 30, 15)];
    lbl_title.text = @"个人文件";
    lbl_title.textColor = [UIColor grayColor];
    lbl_title.font = [UIFont systemFontOfSize:15.0f];
    [view_bg addSubview:lbl_title];
}










@end
